package Test4;

import Test2.Circle;
import Test2.Point;

public class InheritCircle extends Circle {


    public InheritCircle(){
        super(0,0,0);
    }
    public InheritCircle(int x,int y,int r){
        super(x,y,r);
    }
    public InheritCircle(Point c,int r){
        super(c,r);
    }

    public int getX(){
        return super.getCenterX();
    }
    public int getY(){
        return super.getCenterY();
    }

    @Override
    public String toString() {
        return "圆心"+"("+this.center.getX()+","+this.center.getY()+")"+"半径"+this.radius;
    }

    //判断圆心是否相等
    @Override
    public boolean equals(Object obj){
        if(obj==null){
            return false;
        }
        if(obj instanceof InheritCircle){
            InheritCircle prt=(InheritCircle) obj;
            if(prt.getX()==this.getX()&&prt.getY()==this.getY()&&prt.getR()==this.getR()){
                return true;
            }
        }
        else if(obj instanceof Circle){
            Circle prt=(Circle) obj;
            if(prt.getCenterX()==this.getX()&&prt.getCenterY()==this.getY()&&prt.getR()==this.getR()){
                return true;
            }
        }
        return false;
    }
}
